MCQ Answer

Read the following Python code carefully and point out the global variables?

  y, z = 1, 2  def f():      global x      x = y+z

Read the following Python code carefully and point out the global variables?

  y, z = 1, 2  def f():      global x      x = y+z


निम्नलिखित पायथन कोड को ध्यान से पढ़ें और ग्लोबल वैरिएबल को पॉइंट आउट करें?
Topic : Functions in Python

A. x

B. y and z

C. x, y and z

D. Neither x, nor y, nor z




Correct Answer is :

C. x, y and z



Explanation
In the code shown above, x, y and z are global variables inside the function f. y and z are global because they are not assigned in the function. x is a global variable because it is explicitly specified so in the code. Hence, x, y and z are global variables.
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz